package com.xux.service.impl;

import cn.hutool.json.JSONUtil;
import com.xux.dao.OrderSlicDao;
import com.xux.model.bo.OrderSlicGroupBO;
import com.xux.model.po.OrderSlic;
import org.bson.Document;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * @author: xux
 * @date: 2022-06-30 15:23
 * @version: 1.0
 **/

@Service

public class OrderSlicService {

    @Resource
    private OrderSlicDao orderSlicDao;

    public OrderSlic findOneById(Long id) {
        OrderSlic orderSlic = Optional.ofNullable(orderSlicDao.findById(id)).orElse(null);
        return orderSlic;
    }

    public List<OrderSlicGroupBO> testGroup(String outerId) {
        return orderSlicDao.testGroup(outerId);
    }

    public List<Document> testGroupDocument(String outerId) {
        return orderSlicDao.testGroupDocument(outerId);
    }

    public List<Map> correlationQuery () {
        return orderSlicDao.correlationQuery();
    }

    public List<Map> queryByParams (Long teacherId,String jName) {
        return orderSlicDao.queryByParams(teacherId,jName);
    }

    public List<Map> groupAndCorrelation () {
        return orderSlicDao.groupAndCorrelation();
    }

}
